<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>滚轮事件</title>
		<style type="text/css">
			#box1 {
				width: 100px;
				height: 100px;
				background-color: red;
			}
		</style>
		<script type="text/javascript">
			window.onload = function() {
 
			}
			
			function bind(obj, eventStr, callback) {
				if (obj.addEventListener) {
					obj.addEventListener(eventStr, callback, false);
				} else {
					// this是谁由调用方式决定
					// callback.call(obj)
					obj.attachEvent("on" + eventStr, function(){
						// 在匿名函数中调用回调函数
						callback.call(obj);
					});
				}
			}
		</script>
	</head>
	<body style="height: 2000px;">
		<div id="box1"></div>
	</body>
</html>
